#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char RANK[12] = "EEEEEEDCBAA";
int main(void) {
	int M, s;
	for (scanf("%d", &M); M--;) {
		scanf("%d", &s);
		printf("%c\n", RANK[s / 10]);

	}
	return EXIT_SUCCESS;
}
